import request from './network'

/**
 * 通用上传图片 form-data格式
 * @param {*} data {token, header, data: {image: 图片文件}}
 */
export function commonUploadPicApi(data) {
  return request({
    url: 'applets/v1/consume/image/upload',
    method: 'post',
    header: {
      // Authorization: 'Bearer ' + data.token
      ...data.header
    },
    data: data.data
  })
}

/**
 * 通用删除图片
 * @param {*} data {token, data: {image: 图片文件}}
 */
export function commonDeletePicApi(data) {
  return request({
    url: 'applets/v1/consume/image/delete?url=' + data.data.url,
    method: 'delete',
    header: {
      // Authorization: 'Bearer ' + data.token
    },
  })
}
